package com.foreknow.view;

import com.foreknow.service.impl.GuestbookServiceImpl;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

public class Mohuselect extends JFrame {

	private JPanel contentPane;
	private JLabel label;
	private JTextField textField;
	private JButton button;
	public static List<Object> objects;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Mohuselect frame = new Mohuselect();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Mohuselect() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		label = new JLabel("\u4EE5\u540D\u5B57\u8FDB\u884C\u6A21\u7CCA\u67E5\u8BE2");
		label.setFont(new Font("����", Font.PLAIN, 18));
		label.setBounds(134, 10, 189, 56);
		contentPane.add(label);
		
		textField = new JTextField();
		textField.setBounds(144, 76, 141, 31);
		contentPane.add(textField);
		textField.setColumns(10);
		
		button = new JButton("\u67E5\u8BE2");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				GuestbookServiceImpl guestbookService = new GuestbookServiceImpl();
				String name  = textField.getText();
				objects = guestbookService.mohuquery(name);
				Mohujieguoji mohujieguoji = new Mohujieguoji();
				Mohuselect.this.dispose();
			}
		});
		button.setBounds(167, 156, 93, 23);
		contentPane.add(button);
		this.setVisible(true);
	}
}
